/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package controller.web;

/**
 *
 * @author Hatta
 */
import business.ObatListing;
import business.DaftarUser;
import business.Obat;
import business.User;
import business.Admin;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpSession;

public class AdminHome extends Servlet {
    private Admin admin;

    public AdminHome() {
        super();
        setTemplate("/WEB-INF/adminHome.jsp");
    }

    @Override
    protected void process() {
        HttpSession session = getRequest().getSession();
        User user = new User();
        DaftarUser du = new DaftarUser();
        if (session.getAttribute("username") != null) {
            String username = (String) session.getAttribute("username");
            user = du.getUser(username);
        } else {
            try {
                getResponse().sendRedirect("login");
            } catch (IOException ex) {
                Logger.getLogger(AdminHome.class.getName()).log(Level.SEVERE, null, ex);
            }

        }
    }

    private boolean validate_obat(){
        ObatListing dl = new ObatListing();
        int xx = dl.getJumlahObat();

        if( xx == 0){
            return false;
        }

        return true;
    }
    }